package com.kevin.blog.dao;

import com.kevin.blog.po.Type;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @Author Kevin
 * @Date 2021-04-24 10:49:05
 */
public interface TypeRepository extends JpaRepository<Type, Long> {
    Type findByName(String name);

    /**
     * 查询按照分类的大小排序前六个
     * 自定义SQL查询
     */
    @Query("select t from Type t")
    List<Type> findTop(Pageable pageable);
}
